package com.hs.jhzd.repository;

import java.util.Date;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.hs.jhzd.entity.MissingSwipeRecord;

@Repository
public interface MissingSwipeRecordRepository extends JpaRepository<MissingSwipeRecord, Long> {

  @Query("select u from MissingSwipeRecord u where u.jsbh= :jsbh and u.jsh= :jsh and (u.cjsj between :startTime and :endTime)")
  List<MissingSwipeRecord> findByJsh(@Param("jsbh") String jsbh, @Param("jsh") String jsh,
      @Param("startTime") Date startTime, @Param("endTime") Date endTime);

  @Query("select u from MissingSwipeRecord u where u.jsbh= :jsbh and u.jsh= :jsh and (u.cjsj between :startTime and :endTime) and u.wsklx= :swipeType")
  List<MissingSwipeRecord> findByJshAndType(@Param("jsbh") String jsbh, @Param("jsh") String jsh,
      @Param("startTime") Date startTime, @Param("endTime") Date endTime,
      @Param("swipeType") String swipeType);


  @Query("select u from MissingSwipeRecord u where u.jsbh= :jsbh and (u.cjsj between :startTime and :endTime) and u.wsklx= :swipeType")
  List<MissingSwipeRecord> findByJsbh(@Param("jsbh") String jsbh,
      @Param("startTime") Date startTime, @Param("endTime") Date endTime,
      @Param("swipeType") String swipeType);


}
